package br.com.skytef.beans.WEB;

import java.sql.SQLException;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.ViewScoped;

import br.com.skytef.dao.DaoTicket;
import br.com.skytef.entity.TicketEntity;

@ManagedBean(name = "RelTicketBean")
@RequestScoped
@ViewScoped
public class RelTicketBean {
	private List<TicketEntity> rel;

	private int text;

	public int getText() {
		return text;
	}

	public void setText(int text) {
		this.text = text;
	}

	public List<TicketEntity> getRel() {
		return rel;
	}

	public void setRel(List<TicketEntity> rel) {
		this.rel = rel;
	}

	@PostConstruct
	public void init() throws SQLException{
		this.load();
		this.setText(0);
	}

	private void load() {
		try {
			
			rel = new DaoTicket().selectTicketEmp();

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	
	public void searchTicket() throws SQLException, Exception{
		System.out.println("passou");
		rel = new DaoTicket().selectOneTicketEmp(text);
	}


}
